import Koa from 'koa'
import Router from 'koa-router'
import bodyParser from 'koa-bodyparser'
import cors from '@koa/cors'
import { appPort } from './config/setting.js'
import { sync } from './model/Blog.js'
import { registerRouter } from './router/blogRouter.js'

const app = new Koa()
const router = new Router()

app.use(bodyParser())

registerRouter(router)

app.use(cors())

sync()

app.use(router.routes())

app.listen(appPort)
console.log(`服务器运行地址为：http://localhost:${appPort}`);
